﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="driver.ascx.cs" Inherits="driver" %>


<asp:Panel ID="pnl_drivers" runat="server">

<asp:ListView ID="ListView2" runat="server" DataSourceID="SqlDataSource2" 
    GroupItemCount="5">
    <AlternatingItemTemplate>
       <td id="Td1" runat="server" style="background-color: #151613;color: #F0F0F0;">
       
          <a href="driverdetail.aspx?Detail=<%# Eval("UserName") %>&height=220&width=600" class="thickbox">
           
            <img src='images/avatar/<%# Eval("UserName") %>.jpg' alt="" width="120" height="150"/>
            <br />
            <asp:Label ID="UserNameLabel" runat="server" 
                Text='<%# Profile.GetProfile(Eval("UserName").ToString()).FirstName + " " +Profile.GetProfile(Eval("UserName").ToString()).LastName %>'>
            </asp:Label>
            <br />
            SSN:
            <asp:Label ID="SSNLabel" runat="server" Text='<%# Eval("SSN") %>' />
            
            </a>
        </td>
    </AlternatingItemTemplate>
    <EditItemTemplate>
        <td runat="server" style="background-color: #FFCC66;color: #000080;">
            UserName:
            <asp:TextBox ID="UserNameTextBox" runat="server" 
                Text='<%# Bind("UserName") %>' />
            <br />SSN:
            <asp:TextBox ID="SSNTextBox" runat="server" Text='<%# Bind("SSN") %>' />
            <br />
            <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                Text="Update" />
            <br />
            <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                Text="Cancel" />
            <br />
        </td>
    </EditItemTemplate>
    <EmptyDataTemplate>
        <table runat="server" 
            style="background-color: #151613;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
            <tr>
                <td>
                    No driver found.</td>
            </tr>
        </table>
    </EmptyDataTemplate>
    <EmptyItemTemplate>
        <td runat="server" style="background-color: #151613;color: #F0F0F0;"/>
    </EmptyItemTemplate>
    <GroupTemplate>
        <tr ID="itemPlaceholderContainer" runat="server">
            <td ID="itemPlaceholder" runat="server">
            </td>
        </tr>
    </GroupTemplate>
    <InsertItemTemplate>
        <td runat="server" style="">
            UserName:
            <asp:TextBox ID="UserNameTextBox" runat="server" 
                Text='<%# Bind("UserName") %>' />
            <br />
            SSN:
            <asp:TextBox ID="SSNTextBox" runat="server" Text='<%# Bind("SSN") %>' />
            <br />
            <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                Text="Insert" />
            <br />
            <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                Text="Clear" />
            <br />
        </td>
    </InsertItemTemplate>
    <ItemTemplate>
       <td id="Td1" runat="server" style="background-color: #151613;color: #F0F0F0;">
          <a href="driverdetail.aspx?Detail=<%# Eval("UserName") %>&height=220&width=600" class="thickbox">
           
            <img src='images/avatar/<%# Eval("UserName") %>.jpg' alt="" width="120" height="150"/>
            <br />
            <asp:Label ID="UserNameLabel" runat="server" 
                Text='<%# Profile.GetProfile(Eval("UserName").ToString()).FirstName + " " +Profile.GetProfile(Eval("UserName").ToString()).LastName %>'>
            </asp:Label>
            <br />
            SSN:
            <asp:Label ID="SSNLabel" runat="server" Text='<%# Eval("SSN") %>' />
            
            </a>
        </td>
    </ItemTemplate>
    <LayoutTemplate>
        <table runat="server" align="center">
            <tr runat="server">
                <td runat="server">
                    <table ID="groupPlaceholderContainer" runat="server" border="0" 
                        style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
                        <tr ID="groupPlaceholder" runat="server">
                        </tr>
                    </table>
                </td>
            </tr>
            <tr runat="server">
                <td runat="server" 
                    style="text-align: center;background-color: #151613;font-family: Verdana, Arial, Helvetica, sans-serif;color: #FFF000;">
                    <asp:DataPager ID="DataPager1" runat="server" PageSize="15">
                        <Fields>
                           <%-- <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                ShowNextPageButton="False" ShowPreviousPageButton="False" />--%>
                            <asp:NumericPagerField />
                            <%--<asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" 
                                ShowNextPageButton="False" ShowPreviousPageButton="False" />--%>
                        </Fields>
                    </asp:DataPager>
                </td>
            </tr>
        </table>
    </LayoutTemplate>
    <SelectedItemTemplate>
        <td runat="server" 
            style="background-color: #FFCC66;font-weight: bold;color: #000080;">
            UserName:
            <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' />
            <br />
            SSN:
            <asp:Label ID="SSNLabel" runat="server" Text='<%# Eval("SSN") %>' />
            <br />
        </td>
    </SelectedItemTemplate>
</asp:ListView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
    ConnectionString="<%$ ConnectionStrings:conn %>" 
    SelectCommand="SELECT UserName, SSN FROM dbo.Driver">
</asp:SqlDataSource>

</asp:Panel>


<asp:Panel ID="pnl_driverdetail" runat="server">

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
    SelectMethod="GetProfile" TypeName="ProfileCommon">
    <SelectParameters>
        <asp:QueryStringParameter Name="username" QueryStringField="Detail" 
            Type="String" />
    </SelectParameters>
</asp:ObjectDataSource>
<asp:FormView ID="FormView1" runat="server" 
    DataSourceID="ObjectDataSource1">
    <ItemTemplate>
    <table width="600px">
    <tr>
        <td>    
        <b>Name:</b>
        <asp:Label ID="FirstNameLabel" runat="server" Text='<%# Bind("FirstName") %>' />
        &nbsp;
        <asp:Label ID="LastNameLabel" runat="server" Text='<%# Bind("LastName") %>' /> 
        <br />
        
        <b>Phone:</b>
        <asp:Label ID="PhoneLabel2" runat="server" Text='<%# Bind("Phone") %>' />
            
        <br />
        <b>Address:</b>
            <br />
            No: <asp:Label ID="NoLabel" runat="server" Text='<%# Bind("No") %>' />
            &nbsp;,&nbsp;
            <asp:Label ID="StreetLabel" runat="server" Text='<%# Bind("Street") %>' /> 
            &nbsp;,&nbsp;       
            <asp:Label ID="VicinityLabel" runat="server" Text='<%# Bind("Vicinity") %>' />
            &nbsp;,&nbsp;
            <%# City = String.Format("{0}",Eval("City").ToString())  %>
            <%# Town = String.Format("{0}",Eval("Town").ToString())  %>
            <%# getCityTownName() %>
        
        </td>
        <td>
            <img src='images/avatar/<%# Request.QueryString["Detail"] %>.jpg' align="right" alt="Driver Image" width="160px" height="200px"/>
        </td>    
    </tr>
        
 
    </table>
        
    
    </ItemTemplate>
    <EmptyDataTemplate>
        <table id="Table1" runat="server" 
            style="background-color: #151613;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
            <tr>
                <td>
                    No detail found.</td>
            </tr>
        </table>
    </EmptyDataTemplate>
</asp:FormView>
</asp:Panel>


